package com.duowei.kitchenshow.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.duowei.kitchenshow.MainActivity;
import com.duowei.kitchenshow.R;
import com.duowei.kitchenshow.app.MyApp;
import com.duowei.kitchenshow.utils.SpUtils;

public class AutoStartReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        boolean autoStart = (boolean) SpUtils.get(MyApp.getContext().getString(R.string.autostart), false);
        if(autoStart==true&&intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
            Intent intent1=new Intent(context, MainActivity.class);
            intent1.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent1);
        }
    }
}
